package com.mooc.yohoshop.ui.order;

import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;

import com.blankj.utilcode.util.BarUtils;
import com.mooc.yohoshop.R;

public class OrderActivity extends AppCompatActivity implements View.OnClickListener {
    private ViewPager viewPager;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        View view = View.inflate(this,R.layout.activity_order,null);
        setContentView(view);
        BarUtils.addMarginTopEqualStatusBarHeight(view);
        BarUtils.setStatusBarLightMode(this,false);
        BarUtils.setStatusBarColor(this, Color.BLACK);
        findViewById(R.id.mWaitPayOrderTv).setOnClickListener(this::onClick);
        findViewById(R.id.mWaitConfirmOrderTv).setOnClickListener(this::onClick);
        findViewById(R.id.mCompleteOrderTv).setOnClickListener(this::onClick);
        findViewById(R.id.mAllOrderTv).setOnClickListener(this::onClick);
        findViewById(R.id.back).setOnClickListener(this::onClick);
        viewPager = findViewById(R.id.order_vp);
        viewPager.setAdapter(new OrderFragmentAdapter(getSupportFragmentManager()));
    }

    @Override
    public void onClick(View v) {
        int id = 0;
        switch (id){
            case R.id.mWaitPayOrderTv:
                viewPager.setCurrentItem(0);
                break;
            case R.id.mWaitConfirmOrderTv:
                viewPager.setCurrentItem(1);
                break;
            case R.id.mCompleteOrderTv:
                viewPager.setCurrentItem(2);
                break;
            case R.id.mAllOrderTv:
                viewPager.setCurrentItem(3);
                break;
            case R.id.back:
                finish();
                break;
        }
    }
}
